// // import GamePanel_1 from "../UI/GamePanel_1";

import { _decorator, Node, instantiate } from 'cc';
const { ccclass, property } = _decorator;

import { ChengYu_GameData } from "../Data/ChengYu_GameData";
import XXL_Grid from "../Game/XXL_Grid";
import ChengYu_GamePanel_1 from "../UI/ChengYu_GamePanel_1";

@ccclass('ChengYuCardFunctions')
export default class ChengYu_CardFunctions {
    //    /** 创建格子 */
    static CreateGrid(_id: number, x: number, y: number): XXL_Grid {
        const node: Node = instantiate(ChengYu_GamePanel_1.Instance.Prefab_Grid);
        const scrGrid: XXL_Grid = node.getComponent(XXL_Grid);
        ChengYu_GamePanel_1.Instance.main.addChild(node);
        scrGrid.init(_id, x, y);

        return scrGrid;
        // return null;
    }
    //    // 获取一张卡
    static GetGrid(x: number, y: number) {
        if (ChengYu_GameData.arrGrids[x] && ChengYu_GameData.arrGrids[x][y]) {
            return ChengYu_GameData.arrGrids[x][y];
        }

        return null;
    }
}